<?php

namespace App\Agent\Controllers;

use App\Http\Controllers\Controller;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Widgets\Card;
use Illuminate\Support\Facades\Auth;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('控制台')
            ->body(function (Row $row) {
                $row->column(12, function (Column $column) {
                    $admin = Auth::guard('agent');
                    $user = $admin->user();
                    $weeks = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
                    $props = [
                        'user'=>['name'=>"账号",'username'=>$user['username']],
                        'date'=>date("Y年m月d日")." ".$weeks[date("w")],
                        'times'=>date("H:i:s"),'weeks'=>$weeks
                    ];
                    $card = Card::make("欢迎代理商管理员",view('shop.home.index',$props));
                    $column->row($card);
                });

            });
    }

}
